<template>
  <div class="divBox">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <div class="container">
          <el-form inline size="small">
          </el-form>
        </div>
      </div>
      <el-table
        v-loading="listLoading"
        :data="listData.list"
        size="mini"
        class="table"
        highlight-current-row
        :header-cell-style="{ fontWeight: 'bold' }"
      >
      <el-table-column
          prop="name"
          label="奖励名称"
          min-width="180"
        ></el-table-column>
        <el-table-column
          prop="description"
          label="奖励描述"
          min-width="180"
        ></el-table-column>
        <el-table-column
          label="操作"
          min-width="100"
          fixed="right"
          align="center"
        >
          <template slot-scope="scope">
            <el-button
              type="text"
              size="small"
              @click="handlerDelete(scope.row)"
              v-hasPermi="['admin:article:delete']"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="listPram.page"
        :page-sizes="constants.page.limit"
        :layout="constants.page.layout"
        :total="listData.total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-card>
  </div>
</template>
  
  <script>
import { jiangliListApi, jianglinDeleteApi } from "@/api/jiangli";
export default {
  name: "JiangliList",
  data() {
    return {
      constants: this.$constants,
      listPram: {
        shopId: null,
        page: 1,
        limit: this.$constants.page.limit[0],
      },
      listData: { list: [], total: 0 },
      listLoading: true,
    };
  },
  mounted() {
    this.handlerGetListData(this.listPram);
  },
  methods: {

    handerSearch() {
      this.listPram.page = 1;
      this.handlerGetListData(this.listPram);
    },
    handlerGetListData(pram) {
      this.listLoading = true;
      jiangliListApi(pram).then((data) => {
        this.listData = data;
        this.listLoading = false;
      });
    },

 
    handlerDelete(rowData) {
      this.$confirm("确定删除当前数据", "提示").then((result) => {
        jianglinDeleteApi(rowData.id).then((data) => {
          this.$message.success("删除数据成功");
          this.handlerGetListData(this.listPram);
        });
      });
    },
    handleSizeChange(val) {
      this.listPram.limit = val;
      this.handlerGetListData(this.listPram);
    },
    handleCurrentChange(val) {
      this.listPram.page = val;
      this.handlerGetListData(this.listPram);
    },
  },
};
</script>
  
  <style scoped lang="scss">
.articleModal {
  z-index: 333 !important;
}
.flex {
  display: flex;
  align-items: center;
  &-1 {
    flex: 1;
  }
  &-2 {
    flex: 2;
  }
}
</style>
  